<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body style="font-family:Arial, Helvetica, sans-serif; font-size:13px; background-color:#96D3A8; color:#330;">

<h1>
<?php 
date_default_timezone_set('Australia/Melbourne');
$dateToday = date("Y-m-d");
$shopName = new Model_DbTable_Shoplocation();
$faultyReason = new Model_DbTable_Faultyreason();
$sp = new Model_DbTable_Suppliers();
$spList = $sp->listLocalSuppliers();
$sN = $shopName->getNameByHead($this->shophead);
echo $sN['name_of_shop']
?>
</h1>




<?
if($this->faultyproducts){
foreach($this->faultyproducts as $key =>$value )
{
?>
<form action="/faultyaudit/updateaudit" method="post">
<table width="800" border="1" cellspacing="0" cellpadding="3" style="border:#BBB 1px solid;">

  <tr>
    <td style="width:80px;">RAM#</td>
    <td style="width:120px;"><?php echo $value['shopcode_faulty']?><input type="hidden" name="shophead" value="<?php echo $value['shopcode_faulty']?>" /></td>
    <td style="width:120px;"><?php echo $value['staff_name_faulty']?><input type="hidden" name="staffname" value="<?php echo $value['staff_name_faulty']?>" /></td>
    <td><?php echo $value['date_faulty']?></td>
    <td style="width:120px;" >Week:[<?php echo $value['week_of_year_faulty']?>]</td>
  </tr>
  <tr>
    <td rowspan="9"><?php echo $value['id_faulty']?><input type="hidden" name="id_faulty" value="<?php echo $value['id_faulty']?>" /></td>
    <td><?php echo $value['product_code_faulty']?><input type="hidden" name="productfaultcode" value="<?php echo $value['product_code_faulty']?>" /></td>
    <td colspan="3">Qty:[<?php echo $value['faulty_qty']?>]<input type="hidden" name="faultqty" value="<?php echo $value['faulty_qty']?>" /><?php echo $value['product_name_faulty']?> </td>
  </tr>
  <tr>
    <td><?php echo $value['reason_faulty']?></td>
    <td colspan="3">
<?php
	echo $faultyReason->getReasonDesByID($value['reason_faulty']);
?>    
    </td>
  </tr>
  <tr>
    <td colspan="4"><?php echo $value['comment_faulty']?></td>
  </tr>
  <tr>
    <td>Sale Date:</td>
    <td><?php echo $value['date_sales']?></td>
    <td rowspan="3">
      Server Time: [<?php  echo $dateToday?>]<input type="hidden" name="audit_date" value="<?php  echo $dateToday?>" />Your Comment Here:
      <br />
      <textarea name="audit_comment" id="audit_comment" cols="50" rows="3"><?php echo $value['audit_comment']?></textarea>      <br /></td>
    <td rowspan="3">&nbsp;</td>
    </tr>
  <tr>
    <td>Invoice:</td>
    <td><?php echo $value['id_invoice']?><input type="hidden" name="invoice" value="<?php echo $value['id_invoice']?>" /></td>
    </tr>
  <tr>
    <td>Return Date: </td>
    <td><?php echo $value['date_return']?></td>
    </tr>
  <tr>
    <td rowspan="3">Handling<br />
      Method</td>
    <td><input type="radio" name="audit_faulty" id="audit_faulty1" value="1" />
Accept-&gt;<br />
<br /><br /></td>
    <td><input type="radio" name="audit_handle" id="audit_handle3" value="3" />
      <label for="audit_handle">Dispose<br />
        <input type="radio" name="audit_handle" id="audit_handle4" value="4" />
        Waiting Return To Supplier 
        <select name="audit_supplier">
        <?php
        foreach($spList as $k3 => $v3){
		?>
			<?php if($v3['short_title'] != 'MORE' && $v3['short_title'] != 'CELLENET' && $v3['short_title'] != 'FORCE'
					&& $v3['short_title'] != 'AVANTALK' && $v3['short_title'] != 'BP' && $v3['short_title'] != 'EB Parts'
					&& $v3['short_title'] != 'RH' && $v3['short_title'] != 'LU' && $v3['short_title'] != 'RAF' 
					&& $v3['short_title'] != 'XD' && $v3['short_title'] != 'TT' && $v3['short_title'] != 'MC'){?>
          <option value="<?=$v3['id_supplier']?>"><?=$v3['short_title']?></option>	
        <?php
			}
		}
		?>
        </select>
        <br />
        <input type="radio" name="audit_handle" id="audit_handle5" value="5" />
      Waiting Return To China<br /> 
      
      <input type="radio" name="audit_handle" id="audit_handle6" value="6" />
      Sale In Other Chanel
      <br />
      <input type="radio" name="audit_handle" id="audit_handle9" value="9" />
      Parts Damaged By Technician
      </label></td>
    <td rowspan="3"><input type="submit" name="button" id="button" value="Submit" onclick="return confirm('This RMA ID: <?php echo $value['id_faulty']?> Has been Handled, Please Click Ok to Proceed')" /></td>
  </tr>
  <tr>
    <td><input type="radio" name="audit_faulty" id="audit_faulty2" value="2" />
      Reject-&gt;</td>
    <td><input type="radio" name="audit_handle" id="audit_handle2" value="2" />
      Resellable Condition, Waiting Send Back<br />
      <input type="radio" name="audit_handle" id="audit_handle8" value="202" />
      Never Received <input type ="checkbox" name="check_box" id="check_box" style = "margin-left:150px"/>Add stock
      <br />
      <a target="_blank" href="/cam/RMAtakephote.php?fn=<?php echo $value['id_faulty']; ?>" style = "margin-left:245px"><img src="/im/photo-20.jpg"></img></a><input type ="checkbox" name="send_photo" id="send_photo"/>Send Photo
      <br />
<input type="radio" name="audit_handle" id="audit_handle3" value="3" />
      <label for="audit_handle">Dispose<br />
        <input type="radio" name="audit_handle" id="audit_handle4" value="4" />
        Waiting Return To Supplier 
        <select name="audit_supplier2">
        <?php
        foreach($spList as $k3 => $v3){
		?>
          <option value="<?=$v3['id_supplier']?>"><?=$v3['short_title']?></option>	
        <?php
		}
		?>
        </select>
        <br />
        <input type="radio" name="audit_handle" id="audit_handle5" value="5" />
      Waiting Return To China	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Correct Code:<input type = "text" name = "correct_barcode" id = "correct_barcode" style="width: 90px;"></input><br/>
      
      <input type="radio" name="audit_handle" id="audit_handle6" value="6" />
      Sale In Other Chanel
      <br />
      </label>      
      
      
      
      
      
      </td>
  </tr>
  <tr>
    <td><input type="radio" name="audit_faulty" id="audit_faulty3" value="3" />
      Cancel-&gt;</td>
    <td><input type="radio" name="audit_handle" id="audit_handle1" value="1" />
      Key In Error Canceled</td>
  </tr>  
       
</table>
</form> 
<br/>

<?php 
}
}
else "No New Faulty";
?>

</body>
</html>
